<?php session_start();
// $SESSION['email'];
?>
<html>
<head>

<style>
body
{

font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
color: #036;

}
</style>
</head>

<body>
<div id = "headerwrapper">

	<table id = "headerTable">
		<tr>
			<td>
				<img id = "unoLogo" src="Logo1.jpg" /> 
			</td>
			<td>
		<font size ="6.5"> Department of Computer Science </font>
				
			</td>
			<td>
			</td>

			
		</tr>
	</table>

	<div>
	</br>
	</br>
	</br>
<form method='post' action='login.php'>
<table width='400' border='5' align='center'>
<tr>

<td colspan= '5' align= 'center'> <h1> Login Form </h1></td>
</tr>

<td align= 'center'>Email </td>
<td><input type ='text' name='email' /></td>
</tr>
<tr>

<td align= 'center'>User Password</td>
<td ><input type='password' name='pass'/></td>
</tr>
<tr>
<td align= 'center'>Advising Form </td>
<td>
				<select name = 'aform'>
						<option> </option>
						<option>Thesis</option>
					<option>Non-Thesis</option>
				</select>
			</td>


</tr>
<tr>

<td colspan='5' align='center'><input type='submit' name='login' value='Login' /></td>

</tr>

</table>
</form>
<center><b>Not Yet Registered </b></br><a href='registration.php'>Sign Up Here</a></center>
</body>
</html>
<?php

mysql_connect("localhost", "root","");
mysql_select_db("db4208");

//session_start();
// store session data


if(isset($_POST['login'])){

$password=$_POST['pass'];
$email=$_POST['email'];
$aform=$_POST['aform'];

$_SESSION['email']=$email;


$check_user="select * from users where user_pass='$password' AND user_email='$email' AND user_aform='$aform'";

$run = mysql_query($check_user);

if(mysql_num_rows($run)>0){

if($aform=="Non-Thesis"){
header("location: non.php");
//echo "<script> window.open('nonThesis.php')</script>";
}

elseif($aform=="Thesis")
{
header("location: Thesis.php");
//echo " <script> window.open('Thesis.php')</script>";
}
}
else
{
echo "<script> alert('Email/Password is incorrect You might have registered with different advising form')</script>";
}

}
?>